package com.sunrate.investingquote.controller;

import com.alibaba.fastjson2.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * @author yyh
 * @description:
 * @date 2023/07/03/ 11:10
 */
@RestController
@RequestMapping("nginx-test")
@Slf4j
public class NginxTestController {

    private static final String CHANNEL_CODE = "channelCode";

    @PostMapping("/test1")
    public String test1(@RequestHeader(name = CHANNEL_CODE, required = false) String channelCode, HttpServletRequest request, @RequestBody JSONObject jsonObject) {
        log.info("-----------header-name:{}---------------header-value:{}---------", CHANNEL_CODE, channelCode);
        log.info("---------------------------jsonObject:{},value:{}", jsonObject,request.getHeader("CHANNEL_CODE"));
        return "test-success";
    }
}
